package com.minhua.jijiehao2.mainframe.launcher.splashactivity.impl

import android.util.Log
import com.minhua.jijiehao2.base.BaseMvpPresenter
import com.minhua.jijiehao2.bean.BaseBean
import com.minhua.jijiehao2.constants.DefineKey
import com.minhua.jijiehao2.http.CallBack
import com.minhua.jijiehao2.http.ParamsMap
import com.minhua.jijiehao2.mainframe.launcher.splashactivity.imp.ISplashPresenter
import com.minhua.jijiehao2.mainframe.launcher.splashactivity.imp.ISplashView

internal class SplashPresenter : BaseMvpPresenter<ISplashView>(), ISplashPresenter {

    private var mSplashModel = SplashModel()

    override fun getSwitchStatus() {
        val map = ParamsMap()
        map.put("channel", "${map.get(DefineKey.UPDATE_CHANNEL)}_v2")
        Log.e("channel", "${map.get(DefineKey.UPDATE_CHANNEL)}_v2")
        mSplashModel.getSwitchStatus(map, object : CallBack<Int>() {
            override fun onSuccess(t: BaseBean<Int>) {
                mSplashModel.saveSwitch(t.data!!)
                v?.onSwitchSuccess()
            }
        })
    }
}